package com.zoke.support.utils;

import java.util.Map;
import java.util.Set;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * json处理工具类
 * 
 * @author JackWu
 * 
 */
public class JsonUtil {
	private JsonUtil() {
	}

	/** map参数转换为json格式 **/
	public static String mapToJson(Map<String, String> map) {
		if (map == null) {
			return "map is null";
		}
		JSONObject job = new JSONObject();
		Set<String> set = map.keySet();
		for (String ss : set) {
			try {
				job.put(ss, map.get(ss));
			} catch (JSONException e) {
				e.printStackTrace();
			}
		}
		return job.toString();
	}
}
